package com.huifenqi.smart.service;

import com.huifenqi.model.Meter;
import com.huifenqi.tookit.GuavaCacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class MeterService {

    public void upsert(Meter meter) {
        GuavaCacheUtil.put(String.format("%s-%s", "meter", meter.getId()), meter);
    }


    public Meter get(Integer id) {
        return GuavaCacheUtil.<Meter>get(String.format("%s-%s", "meter", id));
    }
}
